home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Beta / Quicktime 2.0 Beta.iso / Extensions / Macintosh Easy Open / Documentation / Developer / Interfaces / CIncludes / Translation.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-28  |  5.8 KB  |  155 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Translation.h 
  3.  
  4.     Contains:    Public Interface definitions to TranslationMgr.
  5.  
  6.     Copyright:    © 1989-1993 by Apple Computer, Inc., all rights reserved.
  7. */
  8.  
  9. #ifndef __TRANSLATION__
  10. #define __TRANSLATION__
  11.  
  12.  
  13. #define gestaltTranslationAttr                'xlat'        // ••• move into GestaltEqu.h
  14. #define gestaltTranslationMgrExists            0            // ••• move into GestaltEqu.h
  15. #define gestaltTranslationMgrHintOrder         1            // True if hint order reversal fix in effect
  16.  
  17. //#define gestaltStandardFileAttr            'stdf'        
  18. //#define gestaltStandardFile58                0        
  19. #define gestaltStandardFileTranslationAware    1            // ••• move into GestaltEqu.h
  20. #define gestaltStandardFileHasColorIcons    2            // ••• move into GestaltEqu.h
  21.  
  22. //#define gestaltEditionMgrAttr                'edtn'        
  23. //#define gestaltEditionMgrPresent            0
  24. #define gestaltEditionMgrTranslationAware    1            // ••• move into GestaltEqu.h
  25.  
  26. #define gestaltScrapMgrAttr                    'scra'        
  27. #define gestaltScrapMgrTranslationAware        0            // ••• move into GestaltEqu.h
  28.  
  29. // Public Errors
  30. #define noTranslationPathErr                    -3030        // ••• move into Errors.h
  31. #define badTranslationSpecErr                    -3031        // ••• move into Errors.h
  32. #define noPrefAppErr                            -3032        // ••• move into Errors.h
  33.  
  34. // #define invalidTranslationPathErr            -3025        // ••• move into Errors.h (TranslationExtensions.h)
  35. // #define couldNotParseSourceFileErr            -3026        // ••• move into Errors.h (TranslationExtensions.h)
  36.  
  37. #ifndef REZ
  38.  
  39. #ifndef __TYPES__
  40. #include <Types.h>
  41. #endif
  42.  
  43. #ifndef __FILES__
  44. #include <Files.h>
  45. #endif
  46.  
  47. #ifndef __MEMORY__
  48. #include <Memory.h>
  49. #endif
  50.  
  51. #ifndef __TRANSLATIONEXTENSIONS__
  52. #include <TranslationExtensions.h>
  53. #endif
  54.  
  55. // block of data that describes how to translate
  56. typedef long FileTranslationSpec[12];
  57.  
  58. // enumerated types on how a document can be opened
  59. typedef short DocOpenMethod;
  60. enum { domCannot, domNative, domTranslateFirst, domWildcard };
  61.  
  62.  
  63. //////////////////////////////////////////////////////////////////////////////////////////////
  64. //
  65. //  GetFileTypesThatAppCanNativelyOpen
  66. //
  67. // This routine returns a list of all FileTypes that an application can open by itself
  68. //
  69. // Enter:    appVRefNumHint        volume where application resides (can be wrong, and if is, will be used as a starting point)
  70. //            appSignature        signature (creator) of application
  71. //            nativeTypes            pointer to a buffer to be filled with up to 64 FileTypes
  72. //
  73. // Exit:    nativeTypes            zero terminated array of FileTypes that can be opened by app
  74. //
  75. pascal OSErr GetFileTypesThatAppCanNativelyOpen(short         appVRefNumHint,
  76.                                                 OSType         appSignature,
  77.                                                 FileType*    nativeTypes)
  78.      = {0x701C,0xABFC}; 
  79.  
  80.  
  81. //////////////////////////////////////////////////////////////////////////////////////////////
  82. //
  83. // ExtendFileTypeList
  84. //
  85. // This routine makes a new list of file types that can be translated into a type in the given list
  86. // Used by StandardFile
  87. //
  88. // Enter:    originalTypeList        pointer to list of file types that can be opened
  89. //            numberOriginalTypes        number of file types in orgTypeList
  90. //             extendedTypeList        pointer to a buffer to be filled with file types
  91. //            numberExtendedTypes        max number of file types that can be put in extendedTypeList
  92. //
  93. // Exit:    extendedTypeList        buffer filled in with file types that can be translated
  94. //            numberExtendedTypes        number of file types put in extendedTypeList
  95. //
  96. pascal OSErr ExtendFileTypeList(const FileType*    originalTypeList,
  97.                                       short     numberOriginalTypes,
  98.                                       FileType* extendedTypeList,
  99.                                       short*     numberExtendedTypes)
  100.      = {0x7009,0xABFC}; 
  101.  
  102.  
  103. ////////////////////////////////////////////////////////////////////////////////////////////////
  104. //
  105. // This routine checks if a file can be opened by a particular application.
  106. // If so, it returns if it needs to be translated first, and if so then how.
  107. // The FileTypes that the app can open are specified by nativelyOpenableTypes,
  108. // or if it is NULL, GetFileTypesThatAppCanNativelyOpen is called.
  109. //
  110. // Enter:    targetDocument        document to check if it can be opened
  111. //            appVRefNumHint        vRefNum of application to open doc ( can be wrong, and if is, will be used as a starting point)
  112. //            appSignature        signature (creator) of application to open doc
  113. //            nativeTypes            zero terminated list of FileTypes app can open natively, or NULL to use default list
  114. //            onlyNative            whether to consider if document can be translated before opening
  115. //            howToOpen            pointer to buffer in which to put how the document can be opened
  116. //            howToTranslate        pointer to buffer in which to put a FileTranslationSpec record
  117. //
  118. // Exit:    howToOpen            whether file needs to be translated to be read
  119. //            howToTranslate        if file can be translated, buffer filled in with how to translate
  120. //            returns                noErr, noPrefAppErr
  121. //
  122. pascal OSErr CanDocBeOpened(const FSSpec*                targetDocument, 
  123.                                   short                 appVRefNumHint, 
  124.                                   OSType                 appSignature,
  125.                             const FileType*                nativeTypes,
  126.                                   Boolean                onlyNative,
  127.                                   DocOpenMethod*         howToOpen,
  128.                                   FileTranslationSpec*    howToTranslate)
  129.      = {0x701E,0xABFC}; 
  130.  
  131.  
  132. //////////////////////////////////////////////////////////////////////////////////////////////
  133. //
  134. //  TranslateFile
  135. //
  136. // This routine reads a file of one format and writes it to another file in another format. 
  137. // The information on how to translated is generated by the routine CanDocBeOpened.
  138. // TranslateFile calls through to the TranslateFile Extension's DoTranslateFile routine.  
  139. // The destination file must not exist.  It is created by this routine.  
  140. //
  141. // Enter:    sourceDocument            input file to translate
  142. //            destinationDocument        output file of translation
  143. //            howToTranslate            pointer to info on how to translate
  144. // Exit:    returns                    noErr, badTranslationSpecErr 
  145. //
  146. pascal OSErr  TranslateFile(const FSSpec*                 sourceDocument,
  147.                             const FSSpec*                 destinationDocument, 
  148.                             const FileTranslationSpec*     howToTranslate)
  149.      = {0x700C,0xABFC}; 
  150.  
  151.  
  152.  
  153. #endif  // REZ
  154. #endif  // __TRANSLATION__
  155.